﻿#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
using namespace std;


// C++11的⽅法
class Base final
{
	public :
	void func5() { cout << "Base::func5" << endl; }
protected:
	int a = 1;
private:
	// C++98的⽅法
	/*Base()
	{}*/
};

class Derive :public Base
{
	void func4() { cout << "Derive::func4" << endl; }
protected:
	int b = 2;
};

int main()
{
	Base b;
	Derive d;
	return 0;
}





class Person
{
	public :
	string _name; // 姓名
};
class Student : public Person
{
	protected :
	int _num; //学号
};
class Teacher : public Person
{
	protected :
	int _id; // 职⼯编号
};
class Assistant : public Student, public Teacher
{
	protected :
	string _majorCourse; // 主修课程
};
int main()
{
	// 编译报错：error C2385: 对“_name”的访问不明确
	Assistant a;
	a._name = "peter";
	 //需要显⽰指定访问哪个基类的成员可以解决⼆义性问题，但是数据冗余问题⽆法解决
	a.Student::_name = "xxx";
	a.Teacher::_name = "yyy";
	return 0;
}